'\" te
.\" Copyright (c) 2006, Sun Microsystems, Inc.
.\" All Rights Reserved.
.\" Copyright 2006 AT&T
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH STRLOG 9F "Jan 16, 2006"
.SH NAME
strlog \- submit messages to the log driver
.SH SYNOPSIS
.LP
.nf
#include <sys/stream.h>
#include <sys/strlog.h>
#include <sys/log.h>



\fBint\fR \fBstrlog\fR(\fBshort\fR \fImid\fR, \fBshort\fR \fIsid\fR, \fBchar\fR \fIlevel\fR,
     \fBunsigned short\fR \fIflags\fR, \fBchar *\fR\fIfmt\fR, ...);
.fi

.SH INTERFACE LEVEL
.sp
.LP
Architecture independent level 1 (DDI/DKI).
.SH PARAMETERS
.sp
.ne 2
.na
\fB\fImid\fR\fR
.ad
.RS 9n
Identification number of the module or driver submitting the message (in the
case of a module, its \fBmi_idnum\fR value from \fBmodule_info\fR(9S)).
.RE

.sp
.ne 2
.na
\fB\fIsid\fR\fR
.ad
.RS 9n
Identification number for a particular minor device.
.RE

.sp
.ne 2
.na
\fB\fIlevel\fR\fR
.ad
.RS 9n
Tracing level for selective screening of low priority messages. Larger values
imply less important information.
.RE

.sp
.ne 2
.na
\fB\fIflags\fR\fR
.ad
.RS 9n
Valid flag values are:
.sp
.ne 2
.na
\fB\fBSL_ERROR\fR\fR
.ad
.RS 14n
Message is for error logger.
.RE

.sp
.ne 2
.na
\fB\fBSL_TRACE\fR\fR
.ad
.RS 14n
Message is for trace.
.RE

.sp
.ne 2
.na
\fB\fBSL_NOTIFY\fR\fR
.ad
.RS 14n
Mail copy of message to system administrator.
.RE

.sp
.ne 2
.na
\fB\fBSL_CONSOLE\fR\fR
.ad
.RS 14n
Log message to console.
.RE

.sp
.ne 2
.na
\fB\fBSL_FATAL\fR\fR
.ad
.RS 14n
Error is fatal.
.RE

.sp
.ne 2
.na
\fB\fBSL_WARN\fR\fR
.ad
.RS 14n
Error is a warning.
.RE

.sp
.ne 2
.na
\fB\fBSL_NOTE\fR\fR
.ad
.RS 14n
Error is a notice.
.RE

.RE

.sp
.ne 2
.na
\fB\fIfmt\fR\fR
.ad
.RS 9n
\fBprintf\fR(3C) style format string. \fB%e\fR, \fB%g\fR, and \fB%G\fR formats
are not allowed but \fB%s\fR is supported.
.RE

.SH DESCRIPTION
.sp
.LP
The \fBstrlog()\fR function expands the \fBprintf\fR(3C) style format string
passed to it, that is, the conversion specifiers are replaced by the actual
argument values in the format string. The 32-bit representations of the
arguments (up to \fBNLORGARGS\fR) follow the string starting at the next 32-bit
boundary following the string. Note that the 64-bit argument will be truncated
to 32-bits here but will be fully represented in the string.
.sp
.LP
The messages can be retrieved with the \fBgetmsg\fR(2) system call. The
\fIflags\fR argument specifies the type of the message and where it is to be
sent. \fBstrace\fR(8) receives messages from the \fBlog\fR driver and sends
them to the standard output. \fBstrerr\fR(8) receives error messages from the
\fBlog\fR driver and appends them to a file called
\fB/var/adm/streams/error.\fR\fImm-dd\fR, where \fImm-dd\fR identifies the date
of the error message.
.SH RETURN VALUES
.sp
.LP
The \fBstrlog()\fR function returns \fB0\fR if it fails to submit the message
to the \fBlog\fR(4D) driver and \fB1\fR otherwise.
.SH CONTEXT
.sp
.LP
The \fBstrlog()\fR function can be called from user, interrupt, or kernel
context.
.SH FILES
.sp
.ne 2
.na
\fB\fB/var/adm/streams/error.\fR\fImm-dd\fR\fR
.ad
.sp .6
.RS 4n
Error messages dated \fImm-dd\fR appended by \fBstrerr\fR(8) from the
\fBlog\fR driver
.RE

.SH SEE ALSO
.sp
.LP
.BR getmsg (2),
.BR log (4D),
.BR strace (8),
.BR strerr (8),
.BR module_info (9S)
.sp
.LP
\fIWriting Device Drivers\fR
.sp
.LP
\fISTREAMS Programming Guide\fR
